import Vue from "vue";
import Vuex from 'vuex'
import router, {resetRouter} from "@/router";

Vue.use(Vuex)
const store = new Vuex.Store({
    state: {
        currentPathName: 'Home'
    },
    mutations: {
        setPath(state, path) {
            state.currentPathName = path
        },
        logout() {
            // 清除存储的数据
            localStorage.clear()
            router.push('/login')
            // 重置路由
            resetRouter()
        }
    }
})

export default store